package com.zlj.jdbc.jdbcUtils02;

import com.mchange.v2.c3p0.ComboPooledDataSource;

/**
 * 完整的懒汉式获取数据库连接
 * @author bashen
 *
 */
public class SingleJdbcUtils {
	
	private ComboPooledDataSource dataSource;
	
	private SingleJdbcUtils() {
		init();
	}
	
	private void init() {
		dataSource = new ComboPooledDataSource();
	}
	
	private static class LazyLoader {
		private static final SingleJdbcUtils INSTANCE = new SingleJdbcUtils();
	}

	public static SingleJdbcUtils getInstance() {
		return LazyLoader.INSTANCE;
	}
	
	public ComboPooledDataSource getDataSource() {
		return dataSource;
	}
}
